Implement, to be used to detect if the window is currently being moved
authorRichard Hult <richard@imendio.com>
Sat, 16 Jun 2007 15:41:27 +0000 (15:41 +0000)
committerRichard Hult <rhult@src.gnome.org>
Sat, 16 Jun 2007 15:41:27 +0000 (15:41 +0000)
2007-06-16  Richard Hult  <richard@imendio.com>

* gdk/quartz/GdkQuartzWindow.c: (isInMove): Implement, to be used
to detect if the window is currently being moved with the mouse.

svn path=/trunk/; revision=18159

ChangeLog
gdk/quartz/GdkQuartzWindow.c
gdk/quartz/GdkQuartzWindow.h

index 58afdf812e9557f6c9cbb1f5e79bf4bd61e30cd1..7af406dec4aeea7dfd42c5923aebb016e655dab0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-16  Richard Hult  <richard@imendio.com>
+
+       * gdk/quartz/GdkQuartzWindow.c: (isInMove): Implement, to be used
+       to detect if the window is currently being moved with the mouse.
+
 2007-06-16  Richard Hult  <richard@imendio.com>
 
        * gdk/quartz/gdkwindow-quartz.c (gdk_window_set_transient_for):
index 9a97ec4aeecc37bc85fd4ed61c0606d6fbebb48f..cd18e7f9be5588db8c8a25cfb6a8eebdb5848c07 100644 (file)
@@ -1,6 +1,6 @@
 /* GdkQuartzWindow.m
  *
- * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2005-2007 Imendio AB
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-
 #import "GdkQuartzWindow.h"
 #include "gdkwindow-quartz.h"
 #include "gdkprivate-quartz.h"
   _gdk_quartz_events_update_focus_window (window, FALSE);
 }
 
+/* Used in combination with NSLeftMouseUp in sendEvent to keep track
+ * of when the window is being moved with the mouse.
+ */
+-(void)windowWillMove:(NSNotification *)aNotification
+{
+  if (leftDown)
+    inMove = YES;
+}
+
+-(void)sendEvent:(NSEvent *)event
+{
+  switch ([event type])
+    {
+    case NSLeftMouseDown:
+      leftDown = YES;
+      break;
+
+    case NSLeftMouseUp:
+      leftDown = NO;
+      inMove = NO;
+      break;
+
+    default:
+      break;
+    }
+
+  [super sendEvent:event];
+}
+
+-(BOOL)isInMove
+{
+  return inMove;
+}
+
 -(void)windowDidMove:(NSNotification *)aNotification
 {
   NSRect content_rect = [self contentRectForFrameRect:[self frame]];
index 5a00397095f84728851fc7b2800400e02a12d96b..4c2276d3c6329cfbea4eaaf379c614c712bf1dbf 100644 (file)
@@ -1,6 +1,6 @@
 /* GdkQuartzWindow.h
  *
- * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2005-2007 Imendio AB
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  */
 
 #import <AppKit/AppKit.h>
-#include "gdkwindow.h"
+#include <glib.h>
 
 @interface GdkQuartzWindow : NSWindow {
+  BOOL leftDown;
+  BOOL inMove;
 }
 
+-(BOOL)isInMove;
+
 @end